package com.jcode222.controller;


import com.jcode222.entity.Order;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jcode222.entity.Storage;
import com.jcode222.entity.response.ResponseResult;
import com.jcode222.service.IStorageService;

import java.util.List;

/**
 * @author pdai
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private IStorageService storageService;

    /**
     * @param storage storage param
     * @return storage
     */
    @ApiOperation("Add Storage")
    @PostMapping("add")
    public ResponseResult<Storage> add(Storage storage) {
        storageService.save(storage);
        return ResponseResult.success(storageService.findById(storage.getId()));
    }
}
